@extends('frontend/layouts/default')
@section('title')
Tạo từ điển 
@stop
@section('content')
<h3 style="text-align: center"><span class="glyphicon glyphicon-pencil"></span> Tạo từ điển</h3>
<form class="form-horizontal" action="" method="post" accept-charset="utf-8" role="form">
    {{ Form::token() }}
    <input type="hidden" name="data[Question][id]" value=""/>

    <div class="row">
        <div class="col-md-9">
            <div class="form-group {{ $errors->has('title') ? 'error':'' }}">
                <label class="control-label col-sm-4" for="title">
                    Nhập từ  * 
                </label>

                <div class="col-sm-8">
                    <input class="form-control" type="text" name="data[Dictionary][title]" id="" value=""/>
                    <?= $errors->first('title', '<span class="help-inline">:message</span>') ?>
                </div>

            </div>  
            <div class="form-group {{ $errors->has('description') ? 'error':'' }}">
                <label class="control-label col-sm-4" for="title">
                    Mô tả  *
                </label>

                <div class="col-sm-8">
                    <textarea class="form-control" rows="20" name="data[Dictionary][description]"
                              id="textareabox" class="form-control"
                              rows="25">
                    </textarea>
                    <?= $errors->first('description', '<span class="help-inline">:message</span>') ?>
                </div>

            </div>
            <div class="form-group">
                <label class="control-label col-sm-4">Trạng thái </label>

                <div class="col-sm-8">
                    <?php
                    if (!is_null(Sentry::getUser()) && Sentry::getUser()->hasAccess('admin')) {
                        echo Form::select('data[Dictionary][status]', array('hidden' => 'Không hiển thị', 'published' => 'Hiển thị'), 'hidden', array('default' => 'Please Select', 'class' => 'form-control'));
                    } else {
                        echo Form::select('data[Dictionary][status]', array('hidden' => 'Không hiển thị', 'published' => 'Hiển thị'), 'hidden', array('default' => 'Please Select', 'disabled' => 'disabled', 'class' => 'form-control'));
                    }
                    ?>
                </div>
            </div> 
            <div class="form-group ">
                <label class="control-label col-sm-4" for="title">
                    Danh mục từ
                </label>

                <div class="col-sm-8">
                    <?=
                    Form::select('data[Dictionary][category_id]', array('0' => 'Không thuộc danh mục nào') + $data['categories'], null, array('class' => 'form-control'))
                    ?>
                </div>
            </div>  
            <div class="control-group" align="right">
                <div class="controls">
                    <a class="btn btn-link" href="{{route('tu-dien')}}">Hủy</a>
                    <button type="submit" class="btn btn-success">Tạo</button>
                </div>
            </div>
        </div>
    </div>
</form>

<script src="{{asset('assets/commons/js/ckeditor/ckeditor.js')}}" type="text/javascript"></script>
<script type="text/javascript">
CKEDITOR.replace('textareabox', {toolbar: 'CusToolbar', height: '500px'});
</script>
@stop